Adding more logging verbostity#1440
Merged
Merged
Conversation
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1440Or
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1440" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR increases diagnostic logging in the test distributed application builder so that custom AppHost generation and related test runs produce more actionable output (and become even more verbose when RUNNER_DEBUG=1 is set).
Changes:
- Adds xUnit logging provider setup during test builder creation (optionally using an
ITestOutputHelper). - Sets log level to
TracewhenRUNNER_DEBUG=1, otherwise defaults toInformation.
Show a summary per file
| File | Description |
|---|---|
| tests/CommunityToolkit.Aspire.Testing/TestDistributedApplicationBuilder.cs | Adds xUnit-backed logging configuration and conditional log level selection based on RUNNER_DEBUG. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Low
Comment on lines
+57
to
+68
| builder.Services.AddLogging(builder => | ||
| { | ||
| if (testOutputHelper is not null) | ||
| builder.AddXUnit(testOutputHelper); | ||
| else | ||
| builder.AddXUnit(); | ||
|
|
||
| if (Environment.GetEnvironmentVariable("RUNNER_DEBUG") is not null && Environment.GetEnvironmentVariable("RUNNER_DEBUG") == "1") | ||
| builder.SetMinimumLevel(LogLevel.Trace); | ||
| else | ||
| builder.SetMinimumLevel(LogLevel.Information); | ||
| }); |
Contributor
Minimum allowed line rate is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #<ISSUE_NUMBER>
Improving the logging that the tests will provide when we do custom app host generation.
PR Checklist
Other information